perm filename TAKL.BCH[TIM,LSP] blob sn#656548 filedate 1982-04-29 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	 You're too late. This is from JKF at Berkeley:
C00005 ENDMK
CāŠ—;
;;; You're too late. This is from JKF at Berkeley:
;;--- takl : tak using lists as counters
;
(defun takl1 (x y z)
   (cond ((listgeqp1 y x) z)
	 (t (takl1 (takl1 (cdr x) y z)
		   (takl1 (cdr y) z x)
		   (takl1 (cdr z) x y)))))
;;--- takl : tak using lists as counters
;
(defun takl2 (x y z)
   (cond ((listgeqp2 y x) z)
	 (t (takl2 (takl2 (cdr x) y z)
		   (takl2 (cdr y) z x)
		   (takl2 (cdr z) x y)))))

;--- listgeqp : t iff list a is longer or the same size as b
;
(defun listgeqp1 (a b)
   (cond ((null b) t)
	 ((null a) nil)
	 (t (listgeqp1 (cdr a) (cdr b)))))

(defun listgeqp2 (a b)
 (prog ()
       loop (cond ((null b) (return t))
		  ((null a) (return ()))
		  (t (setq a (cdr a)
			   b (cdr b))
		     (go loop)))))

(defun timit1 ()
       ((lambda (t1 x gt)
		(takl1 '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18)
		       '(1 2 3 4 5 6 7 8 9 10 11 12)
		       '(1 2 3 4 5 6))
		(setq t1 (- (runtime) t1))
		(setq gt (- (status gctime) gt))
		(print (list 'runtime
			     (//$ (float  (- t1 gt))
				  1000000.0)))
		(print (list 'gctime
			     (//$ (float gt) 1000000.0))))
	(runtime) ()(status gctime)))

(defun timit2 ()
       ((lambda (t1 x gt)
		(takl2 '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18)
		       '(1 2 3 4 5 6 7 8 9 10 11 12)
		       '(1 2 3 4 5 6))
		(setq t1 (- (runtime) t1))
		(setq gt (- (status gctime) gt))
		(print (list 'runtime
			     (//$ (float  (- t1 gt))
				  1000000.0)))
		(print (list 'gctime
			     (//$ (float gt) 1000000.0))))
	(runtime) ()(status gctime)))